package com.seatch;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
//@EnableDiscoveryClient
@RefreshScope
@RestController
public class EurekaClientWithCloudConfigApplication {
    public static void main(String[] args) {
        System.out.println("EurekaClientWithCloudConfigApplication start");
        new SpringApplicationBuilder(EurekaClientWithCloudConfigApplication.class).web(WebApplicationType.SERVLET).run(args);
    }

    @Value("${eureka.environment:'123'}")
    String welcomeText;

    @RequestMapping(value = "/")
    public String welcomeText() {
        return welcomeText;
    }
    @Autowired
    private Environment environment;

    @RequestMapping(value = "/demo/test")
    public String demoTest()
    {
        return "demo Test result :" + environment.getProperty("server.port");
    }
}
